package mercede.allBean;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import mercede.allDTOs.StandardpkDTO;
import mercede.allManagers.StandardpkManager;

@ManagedBean(name="standardpkbean")
@javax.faces.bean.SessionScoped



public class StandardpkBean {
	@EJB
	private StandardpkManager standardpkmgr;
	private StandardpkDTO standardpkdto;
	
    private  String id1;
	private String city; 
	private int id2;
	
	public int getId2() {
		return id2;
	}

	public void setId2(int id2) {
		this.id2 = id2;
	}



	private Map<String,String> cities = new HashMap<String, String>();  


    
    public String getId1() {
		return id1;
	}

	public void setId1(String id1) {
		this.id1 = id1;
	}

   
	   
    public StandardpkBean() {
   	 standardpkdto = new StandardpkDTO();
    }
    
    @PostConstruct
    public void init () {
    	cities.put("ROME", "ROME");  
        cities.put("PARIS", "PARIS");  
        cities.put("MADRID", "MADRID");  
        cities.put("VENIZ", "VENIZ");  
        cities.put("FLORENCE", "FLORENCE");  
        cities.put("PISSA", "PISSA");  
    
    }
    
    public Map<String, String> getCities() {  
        return cities;  
    }  
  
    public void setCities(Map<String, String> cities) {  
        this.cities = cities;  
    }  
    

    public String getCity() {  
        return city;  
    }  
  
    public void setCity(String city) {  
        this.city = city;  
    }  
     

//=========================================================>	
    

	 public StandardpkDTO getStandardpkdto() {
         return standardpkdto;
 }
	 
	 public void setStandardpkdto(StandardpkDTO standardpkdto)
	 {
		 this.standardpkdto=standardpkdto;
	 }
 
 
 
public List<StandardpkDTO> getListStandardpkDTO(){
    return standardpkmgr.getListStandardpkDTO();
}

public List<?> getListgetStandardpk() {
    return  standardpkmgr.getStandardpk();
}

public List<StandardpkDTO> getListStandardpkDTOByDest()
{
	
	return standardpkmgr.getListStandardpkDTOByDest(city);
	}


public StandardpkDTO getInfoforselectedstandardpk(){
    
     
	return standardpkmgr.getStandardpkDTO(Integer.parseInt(id1));
    		 
}


public void  remove(int kk){
	
	  standardpkmgr.remove(kk);
}

 

 public String register() {
	 standardpkmgr.save(standardpkdto);
         return "";
 }



//============================================>
 
}
